package com.wom.gui;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;

import com.wom.worldmaker.GameWorld;

public class MouseHandler implements MouseListener, MouseMotionListener {


	
	


	public MouseHandler(){
		
	}

	@Override
	public void mousePressed(MouseEvent e) {
		if(e.getButton()==MouseEvent.BUTTON1){
		//	addNewBlock(e);
			GameWorld.player.mousePressedLeft=true;
		

		}else{
			GameWorld.player.mousePressedRight=true;
		}

		if(e.getButton()==MouseEvent.BUTTON3){
		//	removeBlock(e);
			GameWorld.player.mousePressedLeft=false;
			

		}else{
			GameWorld.player.mousePressedRight=false;
		}

		
		


	}

	@Override
	public void mouseReleased(MouseEvent e) {

		if(e.getButton()==MouseEvent.BUTTON1){
			//	addNewBlock(e);
				GameWorld.player.mousePressedLeft=GameWorld.player.mousePressedRight;
			}

			if(e.getButton()==MouseEvent.BUTTON3){
			//	removeBlock(e);
				GameWorld.player.mousePressedRight=GameWorld.player.mousePressedLeft;
			}


	}

	
	

	@Override
	public void mouseDragged(MouseEvent m) {
		GameWorld.mouse.setLocation(m.getX(),m.getY());
		
	}

	@Override
	public void mouseMoved(MouseEvent m) {
				
		GameWorld.mouse.setLocation(m.getX(),m.getY());
		
		

	}

	@Override
	public void mouseClicked(MouseEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void mouseEntered(MouseEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void mouseExited(MouseEvent arg0) {
		// TODO Auto-generated method stub

	}

}
